package com.changgou.feign;

import com.changgou.entity.Result;
import com.changgou.pojo.Order;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @Project: com.changgou.feign
 * @Author: ShaoDi Wang
 * @Date: Created in 2019-08-08 11:21
 * @Description:
 * @Version: 1.0
 */
@FeignClient(name = "order")
public interface OrderFeign {

    /**
     * 提交订单远程调用order微服务生成订单
     *
     * @param order
     * @return
     */
    @PostMapping("/order")
    public Result add(@RequestBody Order order);

    /***
     * 根据ID查询数据
     * @param id
     * @return
     */
    @GetMapping("/order/{id}")
    public Result findById(@PathVariable("id") String id);

    /***
     * 分页搜索实现
     * @param searchMap
     * @param page
     * @param size
     * @return
     */
    @GetMapping(value = "/order/search/{page}/{size}")
    public Result findPage(@RequestParam Map searchMap,
                           @PathVariable("page") Integer page,
                           @PathVariable("size") Integer size);
}
